package com.steria.workshop.android.yrapp;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.Toast;

import com.steria.workshop.android.yrapp.lib.model.WeatherPoint;

public class WeatherDetailActivity extends Activity {

	private WeatherPoint weatherPoint = null;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.weatherdetail);
		
		if(getIntent() != null && getIntent().hasExtra(WeatherPoint.class.getSimpleName())) {
			weatherPoint = getIntent().getParcelableExtra(WeatherPoint.class.getSimpleName());
		}
		
		if(weatherPoint != null) {
			String temperature = weatherPoint.getTemperature() + "*C";
			String windspeed = weatherPoint.getWindSpeed() + " m/s";
			
			((TextView)findViewById(R.id.weatherdetail_temperature)).setText(temperature);
			((TextView)findViewById(R.id.weatherdetail_windspeed)).setText(windspeed);
			
			
		} else {
			Toast.makeText(this, R.string.msg_no_details_for_period, Toast.LENGTH_LONG).show();
		}
		
	}
}
